﻿using System.Collections.Generic;
using Castle.ActiveRecord;

namespace SampleApplication
{
    /// <summary>
    /// Encja adresu
    /// </summary>
    [ActiveRecord]
    public class Address : ActiveRecordBase<Address>
    {
        /// <summary>
        /// Id adresu
        /// </summary>
        [PrimaryKey]
        public int Id { get; set; }

        /// <summary>
        /// Ulica
        /// </summary>
        [Property]
        public string Street { get; set; }

        /// <summary>
        /// Numer domu
        /// </summary>
        [Property]
        public string HomeNumber { get; set; }

        /// <summary>
        /// Numer mieszkania
        /// </summary>
        [Property]
        public string FlatNumber { get; set; }

        /// <summary>
        /// Miejscowość
        /// </summary>
        [Property]
        public string City { get; set; }

        /// <summary>
        /// Kod pocztowy
        /// </summary>
        [Property]
        public string PostalCode { get; set; }

        /// <summary>
        /// Poczta
        /// </summary>
        [Property]
        public string Post { get; set; }

        /// <summary>
        /// Klienci przypisani do adresu
        /// </summary>
        [HasAndBelongsToMany(Table = "CustomerAddresses", ColumnRef = "customerid", ColumnKey = "addressid")]
        public IList<Customer> Customers { get; set; }

        /// <summary>
        /// Konstruktor
        /// </summary>
        public Address()
        {
            Customers = new List<Customer>();
        }

    }
}
